<?php

declare(strict_types=1);

namespace App\Request\config;

use Hyperf\Validation\Request\FormRequest;

class ConfigDataRequest extends FormRequest
{

    protected array $scenes = [
        'create' => ['config_id', 'data'],
        'update' => ['id', 'config_id', 'data'],
    ];
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     */
    public function rules(): array
    {
        return [
            'id' => 'required',
            'data' => 'required',
            'config_id' => 'required',
        ];
    }

    public function messages(): array
    {
        return [
            'id.required' => '请选择配置项',
            'data.required' => '请输入数据',
            'config_id.required' => '请选择配置项',
        ];
    }
}
